package com.smarthospital.entity.dto;

import com.smarthospital.common.util.SHDateUtil;
import com.smarthospital.entity.pojo.DoctorDuty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.util.List;

/**
 * create by sym  2021/5/4 13:02.
 */
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(description="排班列表对象" )
public class DutiesDTO {
    @ApiModelProperty(value = "顺序")
    private Integer sort;
    @ApiModelProperty(value = "日期")
    private String date;
    @ApiModelProperty(value = "数据库日期")
    private String dbDate;
    @ApiModelProperty(value = "星期几")
    private String weekNum;
    @ApiModelProperty(value = "同一日期下的排班对象列表")
    private List<DoctorDuty> list;

    /**
     * 构建今天开始的七天的排班
     * @return
     */
    public static List<DutiesDTO> buildSevenDays() {
        List<DutiesDTO> list = new ArrayList<>(7);
        for (int i = 0; i < 7; i++) {
            list.add(DutiesDTO.builder().sort(i).dbDate(SHDateUtil.dbDateStr(i)).date(SHDateUtil.dateStr(i)).weekNum(SHDateUtil.weekNumStr(i)).build());
        }
        return  list;
    }
}
